﻿using System.ComponentModel;

namespace Navigant.Common
{
    public static class PropertyChangedHelper
    {
        public static void RaisePropertyChanged(PropertyChangedEventHandler propertyChanged, 
            object sender, string propertyName)
        {
            if (propertyChanged != null)
            {
                propertyChanged(sender, new PropertyChangedEventArgs(propertyName));
            }
        }

        public static void RaisePropertyChanged<T>(PropertyChangedEventHandler propertyChanged,
            T originalSender, T modifiedSender, string propertyName)
        {
            PropertyChangedEventArgsSender<T> sender = new PropertyChangedEventArgsSender<T>() 
            { 
                New = modifiedSender, Original = originalSender 
            };
            PropertyChangedHelper.RaisePropertyChanged(propertyChanged, sender, propertyName);
        }
    }
}
